package com.itqianfeng.mapper.impl;

import com.itqianfeng.mapper.CustomersMapping;
import com.itqianfeng.pojo.Customer;
import java.sql.Date;
import java.sql.ResultSet;
import java.sql.SQLException;

public class CustomerMappingImpl implements CustomersMapping{
    @Override
    public Customer mapping(ResultSet resultSet) throws SQLException {

        int customerId = resultSet.getInt("customer_id");
        String firstName = resultSet.getString("first_name");
        String lastName = resultSet.getString("last_name");
        Date birthDate = resultSet.getDate("birth_date");
        String phone = resultSet.getString("phone");
        String address = resultSet.getString("address");
        String city = resultSet.getString("city");
        String state = resultSet.getString("state");
        int points = resultSet.getInt("points");


        return new Customer(customerId,firstName,lastName,new Date(birthDate.getTime()),phone,address,city,state,points);

    }
}
